package com.manthano.security.context;

import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

public class SessionListener implements HttpSessionListener
{

	@Override
	public void sessionCreated(HttpSessionEvent httpSessionEvent)
	{
		// ********** CHANGE IT GET CONTEXT AS A BEAN
		UserSessionContext userSessionContext = new UserSessionContext();
		userSessionContext.registerSession(httpSessionEvent.getSession());
	}

	@Override
	public void sessionDestroyed(HttpSessionEvent httpSessionEvent)
	{
		// ********** CHANGE IT GET CONTEXT AS A BEAN
		UserSessionContext userSessionContext = new UserSessionContext();
		userSessionContext.removeSession(httpSessionEvent.getSession());

	}

}
